<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 是p元素同时使第一个 */
      /* p:first-child {
        color: red;
      } */
      /* nth-child(1) === first-child */
      /* p:nth-child(2n + 1) {
        color: blue;
      } */

      /* p元素并且在相同p元素中的第一个 */
      p:first-of-type {
        color: red;
      }
    </style>
  </head>
  <body>
    <div>
      <div></div>
      <p>段落1</p>
      <p>段落2</p>
      <p>段落3</p>
      <p>段落4</p>
      <p>段落5</p>
    </div>

    <div>
      <p>段落1</p>
      <p>段落2</p>
      <p>段落3</p>
      <p>段落4</p>
      <p>段落5</p>
    </div>

    <div>
      <p>段落1</p>
      <p>段落2</p>
      <p>段落3</p>
      <p>段落4</p>
      <p>段落5</p>
    </div>
  </body>
</html>
